cmake_minimum_required(VERSION 3.10)
project(motor_driver)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# set(CMAKE_CXX_STANDARD 20)

# Add all the source files in the directory
file(GLOB DM_TEST "tests/dm_test.cpp")
file(GLOB 2006_TEST "tests/2006_test.cpp")
file(GLOB 3508_TEST "tests/3508_test.cpp")

file(GLOB HEADERS "Inc/*.hpp")
file(GLOB SOURCES "Src/*.cpp")

include_directories(./Inc)

# Create the executable
add_executable(dm_test ${DM_TEST} ${HEADERS} ${SOURCES})
add_executable(2006_test ${2006_TEST} ${HEADERS} ${SOURCES}
        tests/arm.cpp)
add_executable(3508_test ${3508_TEST} ${HEADERS} ${SOURCES})
add_executable(arm tests/arm.cpp ${HEADERS} ${SOURCES})
# Create the static library
add_library(motor_driver_lib STATIC ${SOURCES})

# target_link_libraries(dm_test motor_driver_lib)
# target_link_libraries(2006_test motor_driver_lib)
# target_link_libraries(3508_test motor_driver_lib)

# Specify the install paths
install(TARGETS motor_driver_lib ARCHIVE DESTINATION /usr/lib)
install(FILES ${HEADERS} DESTINATION /usr/include)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Inc/motor_sockets DESTINATION /usr/include)